import http from "../request"

export const productCategoryList = (params: ICateListPage): RES<IProductCate> => http.get(`menu/list/${params.parentId}?pageNum=${params.pageNum}&pageSize=${params.pageSize}`, { params })

export const productAttributeCategoryListWithAttr = (): RES<ICategoryListWithAttr[]> => {
    return http({
        url: "productAttribute/category/list/withAttr",
    })
}

export const productCategoryCreate = (params: IproductCategoryCreate): RES<IProductCate> => http.post(`productCategory/create`, params)

export const productCategoryUpdateNavStatus = (params: changeNavStatus): RES<number> => {
    return http({
        url: "productCategory/update/navStatus",
        method: "post",
        params
    })
}

export const productCategoryUpdateShowStatus = (params: changeNavShow): RES<number> => {
    return http({
        url: "productCategory/update/showStatus",
        method: "post",
        params
    })
}

export const productCategoryDelete = (id: number): RES<any> => {
    return http({
        url: `productCategory/delete/${id}`,
        method: "post",
    })
}

export const productCategoryId = (id: number): RES<IproductCategoryCreate> => {
    return http({
        url: `productCategory/${id}`,
    })
}

export const productCategoryUpdate = (params: CateList): RES<number> => http.post(`productCategory/update/${params.id}`, params)

export const productAttributeList = (params: IProductAttrListParams): RES<IRoleEdit> => http.get(`/productAttribute/list/${params.cid}?pageNum=${params.pageNum}&pageSize=${params.pageSize}&type=${params.type}`)

export const subjectListAll = (): RES<IsubjectListAll[]> => http.get(`subject/listAll`)

export const prefrenceAreaListAll = (): RES<IprefrenceAreaListAll[]> => http.get(`prefrenceArea/listAll`)

export const productCreate = (productParam: IProductList): RES<IprefrenceAreaListAll[]> => http.post(`product/create`, productParam)


